home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Updaters / WhiteCap 3.0.4 / WhiteCap Source.sit / WhiteCap Source / Common / io / Headers / CEgIFile.h < prev    next >
C/C++ Source or Header  |  1999-07-13  |  1KB  |  48 lines

  1. #pragma once
  2.  
  3. #ifndef _CEGIFILE_
  4. #define _CEGIFILE_
  5.  
  6.  
  7. #include "CEgIStream.h"
  8. class CEgFileSpec;
  9.  
  10. //    Pre:    <inProcArg> will contain the pre passed in as <inProcArg> in ::Search().  
  11. //            <inFilePos> is the file position were a match was found
  12. //    Note:    Returns the number of bytes that should be skipped until resuming the search.  Returns <0 if search should be stopped.
  13. typedef long (*AddHitFcnT)(void* inProcArg, long inFilePos );
  14.  
  15.  
  16. class CEgIFile : public CEgIStream {
  17.  
  18.     protected:
  19.         unsigned long                    mFile;
  20.  
  21.         void                            diskSeek( long inPos );
  22.         virtual void                    fillBlock( unsigned long inStartPos, void* destPtr, long& ioBytes );
  23.         
  24.         enum {
  25.             cSearchBufSize                 = 65000
  26.         };
  27.         
  28.     public:
  29.                                         CEgIFile( unsigned short int inBufSize = cDefaultBufSize );
  30.         virtual                         ~CEgIFile();
  31.         
  32.         // Client fcns...
  33.         virtual void                    open( const CEgFileSpec* inSpecPtr );    
  34.         void                            open( const char* inFileName );
  35.         
  36.         virtual void                    close();
  37.         inline bool                        is_open()                        { return mFile != NULL;        }
  38.         virtual long                    size();
  39.         void                            seekEnd();
  40.         virtual long                    tell();
  41.         virtual void                    seek( long inPos );
  42.  
  43.         void                            Search( UtilStr& inSearchStr, void* inProcArg, bool inCaseSensitive, AddHitFcnT inFcn );
  44. };
  45.  
  46.  
  47. #endif
  48.